package edu.mobbuzz.web.pages;

import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.Retain;
import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.BeanModelSource;

import edu.mobbuzz.daf.bean.Logs;
import edu.mobbuzz.daf.dao.ILogsDao;
import edu.mobbuzz.web.base.SecureBasePage;

public class LogsGridPage extends SecureBasePage{
	@Inject
	private ILogsDao logsDao;
	
	private List<Logs> logsList;
	@Property
	private Logs logs;
	
	@Retain
	private BeanModel logsModel;
	@Inject
	private BeanModelSource beanModelSource;
	@Inject
	private ComponentResources resources;
	
	public ILogsDao getLogsDao() {
		return logsDao;
	}
	
	public BeanModel getLogsModel() {
		return logsModel;
	}	
	
	public List<Logs> getLogsList() {
		if(logsList==null){
			logsList = new ArrayList<Logs>();
		}
		logsList = getLogsDao().queryForList("", "");		
		return logsList;
	}

	public void setLogsList(List<Logs> logsList) {
		this.logsList = logsList;
	}

	void pageLoaded(){
		logsModel = beanModelSource.createDisplayModel(Logs.class, resources.getMessages());
	
	}
}
